define(()=>{
    return function(id,btn){
        const goodsMsg = localStorage.getItem("goodsMsg")?JSON.parse(localStorage.getItem("goodsMsg")):[];


        if(goodsMsg.length<1){
          goodsMsg.push({
            id:id,
            num:1,
            flag:1,
            price:Number(btn.prev("span").html()) 
          })

        }else{
          let i =0
          const f= goodsMsg.some((val,idx)=>{
             i=idx;
             return val.id===id
            })
            if(f){
              goodsMsg[i].num++

            }else{
               goodsMsg.push({
                 id:id,
                 num:1,
                 flag:1,
                 price:Number(btn.prev("span").html()) 
               })
            }

        }
        localStorage.setItem("goodsMsg",JSON.stringify(goodsMsg))
    }
});